Page({
  data: {
    step: 1,
    platform: 'android'
  },

  onLoad: function(options) {
    // 检测平台
    this.detectPlatform();
  },

  detectPlatform: function() {
    const systemInfo = wx.getSystemInfoSync();
    const platform = systemInfo.system.toLowerCase().includes('ios') ? 'ios' : 'android';
    this.setData({ platform });
  },

  nextStep: function() {
    if (this.data.step < 4) {
      this.setData({
        step: this.data.step + 1
      });
    }
  },

  prevStep: function() {
    if (this.data.step > 1) {
      this.setData({
        step: this.data.step - 1
      });
    }
  },

  addToDesktop: function() {
    wx.showToast({
      title: '添加成功！',
      icon: 'success',
      duration: 2000
    });
    
    // 延迟返回上一页
    setTimeout(() => {
      wx.navigateBack();
    }, 1500);
  },

  closeGuide: function() {
    wx.navigateBack();
  }
})